package com.hzsai.controller;

import com.hzsai.entity.HttpStatus;
import com.hzsai.entity.ResponseEntity;
import com.hzsai.schedule.PushServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: hzsai
 * @date : 2020/3/19/ 1:12
 **/
@RestController
public class PushMessageController {

    @Autowired
    private PushServer pushServer;

    @RequestMapping(value = "/push/start", method = RequestMethod.POST)
    public ResponseEntity start() {
        pushServer.start();
        return ResponseEntity.re(HttpStatus.OK);
    }

    @RequestMapping(value = "/push/stop", method = RequestMethod.POST)
    public ResponseEntity stop() {
        pushServer.stop();
        return ResponseEntity.re(HttpStatus.OK);
    }
}
